USE [PeDALS_DEV]
GO

/****** Object:  StoredProcedure [dbo].[PAC_UpdateReadyToIngest]    Script Date: 10/13/2009 12:54:57 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



ALTER PROCEDURE [dbo].[PAC_UpdateReadyToIngest]
	@AcqId INT,
	@ReadyToIngest INT,
	@SuperPackageID VARCHAR(255) = NULL
AS
BEGIN
	TRY
	SET NOCOUNT ON
	BEGIN TRANSACTION
		UPDATE [PeDALS_DEV].[dbo].[SeriesAcquisition]
		SET [PeDALS_DEV].[dbo].[SeriesAcquisition].[SeriesAcquisitionReadyToIngest] = @ReadyToIngest,			
			[PeDALS_DEV].[dbo].[SeriesAcquisition].[ModifiedDate] = GetDate(),
			[PeDALS_DEV].[dbo].[SeriesAcquisition].[ModifiedBy] = 'BizTalk',
			[PeDALS_DEV].[dbo].[SeriesAcquisition].[SuperPackageId] = @SuperPackageID
	WHERE [PeDALS_DEV].[dbo].[SeriesAcquisition].[SeriesAcquisitionId] = @AcqId	
	COMMIT TRANSACTION
END TRY
BEGIN CATCH
      ROLLBACK TRANSACTION
		PRINT 'An error occurred.  Please notify your administrator to check the error database.'
		INSERT INTO [PEDALS_PAC_ERRORS].[dbo].[PAC_ERROR](ErrorNumber, ErrorMessage, CreatedDate)
			VALUES (ERROR_NUMBER(), ERROR_MESSAGE(), GETDATE())
END CATCH



GO


